﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.IServices.ProductInspectionTemplates;
using System.Threading.Tasks;
using VOL.Core.Utilities.Response;
using VOL.Entity.DomainModels.Core;
using VOL.Entity.DomainModels;

namespace VOL.WebApi.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ProductInspectionTemplateController : ControllerBase
    {
        private readonly IProductInspectionTemplateServices _productinspectiontemplateServices;

        public ProductInspectionTemplateController(IProductInspectionTemplateServices productinspectiontemplateServices)
        {
            _productinspectiontemplateServices = productinspectiontemplateServices;
        }
        [HttpPost("AddProductInspectionTemplate")]
        public async Task<ActionResult<WebResponseContent>> Add([FromBody] ProductInspectionTemplate productInspectionTemplate)
        {
            return await _productinspectiontemplateServices.AddProductInspectionTemplateModel(productInspectionTemplate);
        }
        [HttpPost("UpdateProductInspectionTemplate")]
        public async Task<ActionResult<WebResponseContent>> Update([FromBody] ProductInspectionTemplate productInspectionTemplate)
        {
            return await _productinspectiontemplateServices.UpdateProductInspectionTemplateModel(productInspectionTemplate);
        }
        [HttpPost("DelProductInspectionTemplate")]
        public async Task<ActionResult<WebResponseContent>> Delete([FromBody] ProductInspectionTemplate productInspectionTemplate)
        {
            return await _productinspectiontemplateServices.DelProductInspectionTemplateModel(productInspectionTemplate);
        }
        [HttpGet("GetProductInspectionTemplate")]
        public async Task<PageGridData<ProductInspectionTemplate>> GetList([FromQuery] string? PlanNo, int pageIndex = 1, int pageSize = 5)
        {
            return await _productinspectiontemplateServices.GetProductInspectionTemplate(PlanNo, pageIndex, pageSize);
        }
    }
}
